package com.jason.kotlin.gank.ui.fragments

import android.os.Bundle
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jason.kotlin.gank.model.GankDataBean
import com.jason.kotlin.gank.ui.adapter.GankItemAdapter
import com.jason.kotlin.gank.viewmodel.GanHuoViewModel
import com.jason.library.common.base.BasePageStateFragment

/**
 * @description: GanHuoChildFragment
 *
 * @author ChenBaoyang
 * @date 4/19/21 17:12
 */
class GanHuoChildFragment : BasePageStateFragment<GanHuoViewModel, GankDataBean>() {


    private lateinit var type: String

    companion object {
        const val KEY = "key"

        fun newInstance(value: String): GanHuoChildFragment {
            val fragment =
                GanHuoChildFragment()
            val data = Bundle()
            data.putString(KEY, value)
            fragment.arguments = data
            return fragment
        }
    }

    override fun parseArgs() {
        arguments?.run {
            type = getString(KEY) as String
        }
    }

    override fun onDataInit() {
        viewModel!!.type = type
        super.onDataInit()
    }

    override fun getAdapter(): BaseQuickAdapter<GankDataBean, BaseViewHolder> = GankItemAdapter()

    override fun addHeaderView(adapter: BaseQuickAdapter<GankDataBean, BaseViewHolder>) {

    }
}